<%@ page language="java" pageEncoding="ISO-8859-1" import="java.util.*"%>

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
    <html:base />
    
    <title>psperipheral.jsp</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript">

function checkblank(f)
{
  var fps=f.ps.value
   var fpo=f.po.value
   fed=f.ed.value
   
   if((fps.match("select")) || (fpo.match("select")) || (fpo.length==0))
   {
      alert("pls fill all d fields")
      if(fpc.match("select"))
      {
         document.getElementById("pps").innerHTML="<font color=red>This field shdnt be left blank</font>"
      }
      if(fpon.match("select"))
      {
         document.getElementById("ppo").innerHTML="<font color=red>This field shdnt be left blank</font>"
      }
      if(fpon.length==0)
      {
         document.getElementById("ped").innerHTML="<font color=red>This field shdnt be left blank</font>"
      }
      return false;
  }
}
</script>

  </head>
  
  <body bgcolor="pink">
  
  
  <%
   ArrayList did=(ArrayList)request.getAttribute("psid");
   ArrayList dn=(ArrayList)request.getAttribute("ps");
    ArrayList did1=(ArrayList)request.getAttribute("po");
   ArrayList dn1=(ArrayList)request.getAttribute("ponm");
   %>
    
  <html:form action="peria" onsubmit="return checkblank(this)"> 
    <div align="center">
	<table border="0" width="100%">
	<%
	Object ob=request.getAttribute("jlt");
	if(ob!=null){
	 %>
		<tr>
			<td colspan="3"><font color="#6600CC"><u>Police Station Peripheral</u> </font></td>
		</tr>
		<tr>
			<td>Police station</td>
			<td><html:select property="ps">
			<html:option value="select">Enter policce station name</html:option>
			<%if(did!=null){
			for(int i=0;i<did.size();i++)
		    	             { %>
		    	             <html:option value="<%=did.get(i).toString()%>"> <%=dn.get(i).toString() %></html:option>
		    	             <%}} %>
			</html:select> </td>
			<td><label id="pps"></label></td>
		</tr>
		<tr>
			<td>post office</td>
			<td><html:select property="po">
			<html:option value="select">Enter post office name</html:option>
			<%if(did1!=null){
			for(int i=0;i<did1.size();i++)
		    	             { %>
		    	             <html:option value="<%=did1.get(i).toString()%>"> <%=dn1.get(i).toString() %></html:option>
		    	             <%}} %>
			
			</html:select> </td>
			<td><label id="ppo"></label></td>
		</tr>
		<tr>
			<td>Effect date</td>
			<td><html:text property="ed" value=""></html:text> </td>
			<td><label id="ped"></label></td>
		</tr>
		<tr>
			<td colspan="3"><html:submit value="AddPsPeriphery" property="perip"></html:submit> </td>
		</tr>
		
		<tr>
			<td colspan="3"><a href="">VIEW/EDIT</a> </td>
		</tr>
		
		
		<tr>
			<td colspan="3"><%=ob.toString() %> </td>
		</tr>
		<%}
		else
		{ %>
		
		<tr>
			<td colspan="3"><font color="#6600CC"><u>Police Station Peripheral</u> </font></td>
		</tr>
		<tr>
			<td>Police station</td>
			<td><html:select property="ps">
			<html:option value="select">Enter policce station name</html:option>
			<%if(did!=null){
			for(int i=0;i<did.size();i++)
		    	             { %>
		    	             <html:option value="<%=did.get(i).toString()%>"> <%=dn.get(i).toString() %></html:option>
		    	             <%}} %>
			</html:select> </td>
			<td><label id="pps"></label></td>
		</tr>
		<tr>
			<td>post office</td>
			<td><html:select property="po">
			<html:option value="select">Enter post office name</html:option>
			<%if(did1!=null){
			for(int i=0;i<did1.size();i++)
		    	             { %>
		    	             <html:option value="<%=did1.get(i).toString()%>"> <%=dn1.get(i).toString() %></html:option>
		    	             <%}} %>
			
			</html:select> </td>
			<td><label id="ppo"></label></td>
		</tr>
		<tr>
			<td>Effect date</td>
			<td><html:text property="ed"></html:text> </td>
			<td><label id="ped"></label></td>
		</tr>
		<tr>
			<td colspan="3"><html:submit value="AddPsPeriphery" property="perip"></html:submit> </td>
		</tr>
		<tr>
			<td colspan="3"><a href="">VIEW/EDIT</a> </td>
		</tr>
		<%} %>
		
		
		
	</table>
</div>
</html:form> 
    
    
    
  </body>
</html:html>
